package org.aplikator.client.descriptor;

import org.aplikator.client.widgets.BinaryFieldWidget;
import org.aplikator.client.widgets.FormWidget;
import org.aplikator.shared.data.BinaryData;

import com.google.gwt.user.client.ui.Widget;

@SuppressWarnings("serial")
public class BinaryFieldDTO implements WidgetDTO {

    private PropertyDTO<BinaryData> property;
    private EntityDTO entity;

    @SuppressWarnings("unused")
    private BinaryFieldDTO() {
    }

    public BinaryFieldDTO(PropertyDTO<BinaryData> property, EntityDTO entity) {
        this.property = property;
        this.entity = entity;
    }

    public Widget getWidget(FormWidget form) {
        BinaryFieldWidget field = new BinaryFieldWidget(property, entity);
        form.registerBinaryField(field);
        field.setWidth("400px");// TODO add metrics to widget declarations
        field.setHeight("100px");
        return field;
    }

}
